package com.usian.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.usian.appointments.Appointments;
import com.usian.image.Images;
import com.usian.mapper.AppointmentsMapper;
import com.usian.service.AppointmentsService;
import com.usian.user.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppointmentsServiceImpl implements AppointmentsService {
    @Autowired
    private AppointmentsMapper appointmentsMapper;

    @Override
    public PageInfo<Appointments> findAll(Integer page, Integer size, Appointments appointments) {
        PageHelper.startPage(page,size);
        List<Appointments> list = appointmentsMapper.findAll(appointments);

        PageInfo<Appointments> appointmentsPageInfo = new PageInfo<>(list);
        return appointmentsPageInfo;
    }

    @Override
    public List<Appointments> findById(Integer userId) {
        return appointmentsMapper.findById(userId);
    }

    @Override
    public User selectUserByIdTwo(Integer id) {
        return appointmentsMapper.selectUserByIdTwo(id);
    }

    @Override
    public Appointments echo(Integer id) {
        return appointmentsMapper.echo(id);
    }

    @Override
    public int add(Appointments appointments) {
       int appointments1 = appointmentsMapper.add(appointments);
        return appointments1;
    }
}
